Repository navigation
fix(find): reject ambiguous find get text and get attrs - #4699
xiatiandeairen wants to merge 4 commits into
Conversation
|
I reviewed 363f5eb and found one problem that needs a fix before merge. CI is green: the one reported check passes. There are no conflicts. Value reads and mutating find count different candidate sets. The PR and the issue promise the same contract as mutating find. As it stands, an agent can run Would one selectors helper, Not blocking, and fine to take or leave: merge #4698 first, then rebase and re-run the combined suite as the PR body says, because value reads now store an unscoped full capture with one ref and a plain Evidence limits: the iOS live run comes from the PR body. Android and web value reads were not run by anyone, and the unscoped capture cost on Android is unmeasured. The mismatch above is traced from code, not observed live. |
A find value read binds one node, so it now shares the mutating find contract from callstack#1625: several matches fail with AMBIGUOUS_MATCH and the candidate list unless --first or --last picks one. The capture is no longer scoped to the first match, the daemon forwards --first/--last to the read-only runtime, and the printed candidates follow the strict-read issuance rule. exists, wait, and list keep their semantics. Fixes callstack#4685
find <q> get text|attrs counted the raw match list, while mutating find first drops the root interaction container and prefers on-screen matches. On the same tree the two could disagree: a read refused or read the app root where a click bound one element, and --first/--last picked by document order instead of find's ranking. findOneNodeCandidates in @agent-device/selectors now builds the rooted, on-screen-preferred, ranked candidate list, and both resolveFindMatch and findValueReadMatch count and narrow it. preferOnscreenMatches moves from the daemon into the same module.
363f5eb to
1953103
Compare
|
Thanks for the review. Pushed 1953103, rebased on main after #4698 merged. The blocking issue: one candidate set. I added Tests that fail on the old head.
I checked both by swapping the old Two behavior changes:
Also in this push: the Checks run locally: command-runtime, selectors and daemon/execution unit tests pass (1769). The layering tests pass (483/483), and so do lint and the format check. I did not run the full |
|
I reviewed 1953103 against the earlier findings at 363f5eb (#4699 (comment)). The ambiguity refusal for
This delta also changes the live value-read route: which nodes are candidates, their order, and what On CI, Smoke Tests failed in One earlier question is still open: does a recorded There are no conflicts. Before merge, value reads must keep reading rectless and ref-less matches with a test that fails on this head. Then we need the live run at the new head, and the Coverage failure either fixed or shown to be unrelated. |
The eager-closure budget rejected find-candidates.ts: as a new subpath it added a module to command-runtime's closure, and its static edge to the selectors entry made it evaluate 67 modules where the ranking code it replaced evaluated 15. preferOnscreenMatches and its ranking helpers now live in interaction-targeting, whose functions they already called, and findOneNodeCandidates lives in selector-pipeline, which both callers already import. Callers pass the findAct row, typed to that row, so selector-pipeline does not pull in the policy table. The ranking test is renamed for its module. Rollback: reverting this commit restores find-candidates.ts, its ./find-candidates export and the package-boundaries entry; the eager closure budget then fails again until the module is re-homed.
|
I pushed b7ec11e. It fixes the Coverage failure on 1953103. Cause.
Change. The module is gone, and the same code moved into modules that both callers already evaluate:
Checks run locally:
Android smoke. It failed on 1953103 in |
|
The CI checks are green at b7ec11e (12 checks, none failing), and the eager-closure Coverage failure from the earlier review is fixed. The main finding from that review is still open, and one test and one live run are missing. findOneNodeCandidates now takes only the No test in selector-read-find-list.test.ts reads a ref-less, rectless text node through The value-read route changed candidate set, order and One earlier question is still open: does a recorded No conflicts are known. Before merge, value reads need a read row with |
findValueReadMatch passed the findAct row, which requires a rect and a ref, so on web `find "<static text>" get text` refused a node that `find list`, `wait text` and `snapshot` all show. Add a findRead row (reject-candidates, requireRect: false, occlusion ignore) and let findOneNodeCandidates take either row, so reads and taps still share root exclusion and on-screen ranking while addressability comes from the action's row.
|
Thanks for the review. Status at Rectless / ref-less reads. Added a Validation: Live run, iOS 27.2 simulator, MultiTodo with two "dup" rows, CLI and daemon built from
{"code":"AMBIGUOUS_MATCH","details":{"matches":2,"candidates":["@e15 [text] \"dup\"","@e11 [text] \"dup\""],"refsGeneration":421699,"dispatched":"no"}}
Cause: Replay question. It does not keep the flag. Recorded with Replaying it fails: Web not run yet: this host has no managed web backend ( |
|
Web value read at The snapshot gives the line no ref, and {"success":true,"data":{"text":"Order total $42.00","node":{"index":1,"type":"StaticText","role":"StaticText","value":"Order total $42.00","depth":1,"parentIndex":0,"kind":"text"}}}Exit 0. I did not re-run this page at |
|
Thanks for the update. The earlier findings from b7ec11e are addressed at 4efbb21, and one regression remains. Recorded The rule to satisfy: a positional choice that resolved a find action at record time must be replayed with that choice. Mark Not blocking, and these can be taken or left: The code needs the fix above before merge. The only failing check is Body rules, which reads only the PR body (258 words over the 250 limit, and no '## Before / after' section), so it is likely unrelated to the diff. The other 14 checks pass, and there are no conflicts. Not verified here: the new command-runtime test was not run on b7ec11e or at head, the live iOS and web output is the author's paste and was not reproduced, and Android was not run. After the replay fix lands, please refresh the PR body with validation at 4efbb21, a Before / after section and under 250 words so Body rules passes. |
|
4efbb21 now conflicts with main. Please rebase onto main and include the open item from the last review (recorded |
Summary
find <q> get text|attrssilently took the first of several matches. It now follows mutating find's #1625 contract:AMBIGUOUS_MATCHwith the AMBIGUOUS_MATCH and unsupported find actions give agents nothing to recover with #1597 candidates, unless--firstor--lastpicks one.exists,waitandlistare unchanged.To make that work:
CONSERVATIVE:).--firstand--lastto the read-only runtime.16 files.
Fixes #4685
Blocked by #4698. Merge it first: an unscoped read publishes a full frame, which would let a plain ref from an earlier
snapshot -iresolve to the wrong node. #4698 refuses that read. With both branches combined, tests pass (30/30), andhelp workflowis 9,099 bytes against the 9,100 budget.Validation
Head
363f5eb9don baseaa600e980.check:quickpassed. Focused vitest: 2,656 tests pass. The new policy,--lastand candidate-issuance tests fail on base.check:affected --run --head 363f5eb9d: format, lint, typecheck, layering, fallow, build and vitest-related passed.unitfailed only inandroid-sdk-setup-action.test.ts, which fails the same way on base on this host. docs-links and docs-prose passed when run directly.find dup get text: base returnsdupwith exit 0; head returnsAMBIGUOUS_MATCHwith 2 pinned candidates.--firstreturnsdup.find dup existsis true on both.get text @e16is refused instead of reading "Done".🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.